/**
 * Copyright HCP Technology 
 * www.hcp.vn
 */
package models;

import java.util.Date;

import siena.Id;
import siena.Index;
import siena.Model;
import siena.Query;

public class CommentModel extends Model{
	
	@Id
	public Long id;
	
	public String user;
	public Date date;
	public String description;
	
	@Index("content_index")
    public ContentModel content;
	
	public CommentModel(ContentModel content, String user, String description){
		this.content = content;
		this.user = user;
		this.description = description;
		this.date = new Date();
	}
	
	static Query<CommentModel> all(){
		return Model.all(CommentModel.class);
	}
	
	public static CommentModel findById(Long id){
		return all().filter("id", id).get();
	}
}
